<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap.css"/>
<link rel="stylesheet" href="<%=basePath %>css/buttons.css" />
<script src="<%=basePath %>js/Form validation/jquery-1.4.4.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="<%=basePath %>css/Form validation/validator.css"></link>
<script src="<%=basePath %>js/Form validation/formValidator-4.0.1.js" type="text/javascript" charset="UTF-8"></script>
<script src="<%=basePath %>js/Form validation/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>

<script type="text/javascript">
$(document).ready(function(){
	<%-- $(function () {
		$.get('<%=basePath %>' + 'userInfo/selById', function(data) {
			
        });
	}); --%>
	$("#select").click(function(){
		location.href = "<%=basePath %>userInfo/selById";
	});
	$("#exit").click(function(){
		location.href = "<%=basePath %>index.jsp";
	});
	$("#btnUpdate").click(function() {
        var $form = $("form");
        $.ajax({
            cache: true,
            type: "POST",
            url: $form.attr("action"),	//提交的url
            data: $form.serialize(),
            async: false,
            success: function (data) {
            	alert("成功修改个人信息！");
                location.reload();
            },
            error: function (request) {
                alert("修改个人信息出错！");
                location.reload();
            }
        });
    });
});

</script>

<body onload="">
	<br />
	<center>
		<form action="<%=basePath %>userInfo/update" method="post" role="form" id="form1">
			<table width="750" cellpadding="0" >
 				<c:forEach items="${userList }" var="userList"> 
					<tr>
						<td  align="right" width="350">用户名：</td>
						<td width="200"><input id="fusername" name="fusername" value="${userList.fusername }" class="form-control" style="width:160px;height:25px;" readonly></td>
						<td></td>
					</tr>	
					<div style="display: none;">
						<tr>
							<td align="right">密码：</td>
							<td><input type="password" id="fusername" name="fpassword" value="${userList.fpassword }" class="form-control" style="width:160px;height:25px;" readonly></td>
							<td></td>
						</tr>	
					</div>	
					<tr>
						<td align="right">真实姓名：</td>
						<td><input id="fealname" name="fealname" value="${userList.fealname }" class="form-control" style="width:160px;height:25px;" readonly></td>
						<td></td>
					</tr>
					<tr>
					<td align="right">性别：</td>
						<td>
							<label class="radio-inline">
								<input type="radio" name="fsex" id="inlineRadio1" value="男" <c:if test="${userList.fsex == '男'}"> checked="checked"</c:if> > 男
							</label>
							<label class="radio-inline">
							  	<input type="radio" name="fsex" id="inlineRadio2" value="女" <c:if test="${userList.fsex == '女'}"> checked="checked"</c:if>> 女
							</label>
						</td>			
						<td></td>
					</tr>
					<tr>
					<td align="right">身份：</td>
						<td>
							<select id="fidentity" name="fidentity" class="form-control" style="width:160px;height:30px;">
								<option value="成人" <c:if test="${userList.fidentity == '成人' }">selected</c:if>>成人</option>
								<option value="学生" <c:if test="${userList.fidentity == '学生' }">selected</c:if>>学生</option>
								<option value="残疾人、军人" <c:if test="${userList.fidentity == '残疾人、军人' }">selected</c:if>>残疾人、军人 </option>
								<option value="老年人" <c:if test="${userList.fidentity == '老年人' }">selected</c:if>>老年人</option>
							</select>
						</td>
						<td></td>
					</tr>
					<tr>
						<td align="right">身份证号：</td>
						<td><input id="fcertificateno" name="fcertificateno" value="${userList.fcertificateno }" class="form-control" style="width:160px;height:25px;" readonly></td>
						<td></td>
					</tr>
					<tr>
						<td align="right">手机号：</td>
						<td><input id="fphonenumber" name="fphonenumber" value="${userList.fphonenumber }" class="form-control" style="width:160px;height:25px;"></td>
						<td></td>
					</tr>
					<tr>
						<td align="right">固定电话：</td>
						<td><input id="ffixedphone" name="ffixedphone" value="${userList.ffixedphone }" class="form-control" style="width:160px;height:25px;"></td>
						<td></td>
					</tr>
					<tr>
						<td align="right">地址：</td>
						<td><input id="faddress" name="faddress" value="${userList.faddress }" class="form-control" style="width:160px;height:25px;"></td>
						<td></td>
					</tr>
					<tr>
						<td align="right">身高(cm)：</td>
						<td><input id="fheight" name="fheight"  value="${userList.fheight }" class="form-control" style="width:160px;height:25px;"></td>
						<td></td>
					</tr>
					<tr>
						<td align="right">体重(kg)：</td>
						<td><input id="fweight" name="fweight" value="${userList.fweight }" class="form-control" style="width:160px;height:25px;"></td>
						<td></td>
					</tr>
					<tr>
						<td align="right">密码提示问题：</td>
						<td>
							<select id="fpassquestion" name="fpassquestion" class="form-control" style="width:160px;height:30px;">
								<option value="您的出生地是？" <c:if test="${userList.fpassquestion == '您的出生地是？' }">selected</c:if>>您的出生地是？</option>
								<option value="您的小学校名是？" <c:if test="${userList.fpassquestion == '您的小学校名是？' }">selected</c:if>>您的小学校名是？</option>
								<option value="您的中学校名是？" <c:if test="${userList.fpassquestion == '您的中学校名是？' }">selected</c:if>>您的中学校名是？ </option>
								<option value="您的大学校名是？" <c:if test="${userList.fpassquestion == '您的大学校名是？' }">selected</c:if>>您的大学校名是？ </option>
								<option value="我最喜爱的小说？" <c:if test="${userList.fpassquestion == '我最喜爱的小说？' }">selected</c:if>>我最喜爱的小说？ </option>
								<option value="我最喜爱的歌曲？" <c:if test="${userList.fpassquestion == '我最喜爱的歌曲？' }">selected</c:if>>我最喜爱的歌曲？ </option>
								<option value="我最喜爱的食物？" <c:if test="${userList.fpassquestion == '我最喜爱的食物？' }">selected</c:if>>我最喜爱的食物？ </option>
								<option value="我最大的爱好？" <c:if test="${userList.fpassquestion == '我最大的爱好？' }">selected</c:if>>我最大的爱好？ </option>
							</select><br />
						</td>
						<td></td>
					</tr>
					<tr>
						<td align="right">问题答案：</td>
						<td><input id="fpasskey" name="fpasskey" value="${userList.fpasskey }" class="form-control" style="width:160px;height:25px;"></td>
						<td></td>
					</tr>
					<tr>
						<td align="right">邮箱：</td>
						<td><input id="fmailbox" name="fmailbox" value="${userList.fmailbox }" class="form-control" style="width:160px;height:25px;"></td>
						<td><div id="fmailboxTip" style="width:250px"></td>
					</tr>
					</c:forEach>
			</table>
			<table>
				<tr>
					<td colspan="3">
						<!-- <input type="button" value=" 查  询 " 
						class="button button-pill button-primary" style="width:140px;height:40px;" id="select">&nbsp;&nbsp; -->
						<input type="button" value=" 修  改 " id="btnUpdate" onclick="" 
						class="button button-pill button-primary" style="width:140px;height:40px;">&nbsp;&nbsp;
						<input type="button" value=" 返  回 " id="exit"  
						class="button button-pill button-primary" style="width:140px;height:40px;">
					</td>
				</tr>
			</table>
		</form>
	</center>
</body>
</html>